import { createContext, type ReactNode } from 'react';
import { Socket } from '@ac/utils';

interface SocketContextType {
	socketId: string;
	socket: Socket | null;
	isConnected: boolean;
	connect: () => void;
	disconnect: () => void;
}

export const SocketContext = createContext<SocketContextType | undefined>(undefined);

interface SocketProviderProps {
	children: ReactNode;
	socket: any;
}

export const SocketProvider: React.FC<SocketProviderProps> = ({ children, socket }) => {
	return <SocketContext.Provider value={socket}>{children}</SocketContext.Provider>;
};